package me.heizi.springboot.students.controllers


import me.heizi.springboot.students.services.UserService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.*

@Controller
@RequestMapping("/user")
class UserController {

    @Autowired lateinit var service: UserService

    @GetMapping(produces = ["text/html"])
    fun getAllUsers(model: Model):String {
        model.addAttribute("users",service.all)
        return "user"
    }

}
